default_platform(:ios)

platform :ios do
  desc "Build and deploy to TestFlight"
  lane :beta do |options|
    flavor = options[:flavor] || "staging"
    upload_to_testflight(
      ipa: "../build/ios/ipa/{{project_name.snakeCase()}}.ipa",
      skip_waiting_for_build_processing: true,
      distribute_external: false
    )
  end

  desc "Upload to App Store Connect without final publish"
  lane :release do |options|
    flavor = options[:flavor] || "prod"
    upload_to_app_store(
      ipa: "../build/ios/ipa/{{project_name.snakeCase()}}.ipa",
      skip_metadata: true,
      skip_screenshots: true,
      submit_for_review: false,
      automatic_release: false
    )
  end

  desc "Sync certificates with Match"
  lane :certificates do
    match(type: "appstore")
    match(type: "development")
  end
end
